home *** CD-ROM | disk | FTP | other *** search
- unit TstChkU4;
-
- interface
-
- uses
- WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- CheckBox1: TCheckBox;
- procedure CheckBox1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- private
- { Private declarations }
- public
- procedure CMDialogKey(var Msg: TCMDialogKey);
- message cm_DialogKey;
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.CMDialogKey(var Msg: TCMDialogKey);
- begin
- with Msg do
- if (CharCode in [vk_Up, vk_Down]) and
- (ActiveControl = CheckBox1) then
- { Return 0 to stop the keystrokes being "absorbed" }
- Result := 0
- else
- inherited
- end;
-
- procedure TForm1.CheckBox1KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- case Key of
- vk_Up: CheckBox1.Caption := 'Up';
- vk_Down: CheckBox1.Caption := 'Down';
- end;
- end;
-
- end.
-